package com.jinbao.springbootinit.xfxh;

//import cn.hutool.json.JSONArray;
//import cn.hutool.json.JSONException;
//import cn.hutool.json.JSONObject;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.google.gson.JsonParser;
import com.google.gson.JsonSyntaxException;

public class Main {

    public static void main(String[] args) throws Exception {
        String s = "{\n" +
                "  xAxis: {\n" +
                "    type: 'category',\n" +
                "    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']\n" +
                "  },\n" +
                "  yAxis: {\n" +
                "    type: 'value'\n" +
                "  },\n" +
                "  series: [\n" +
                "    {\n" +
                "      data: [150 230, 224, 218, 135, 147, 260],\n" +
                "      type: 'line'\n" +
                "    }\n" +
                "  ]\n" +
                "}";
        System.out.println(s);
        System.out.println(isValidJson(s));


    }

    public static boolean isValidJson(String json) {
        try {
            JsonParser.parseString(json);
            return true;
        } catch (JsonSyntaxException e) {
            return false;
        }
    }

}

